package util;

import java.util.List;
public class Page {

	private int startNum = 1;// 开始个数

	private int pageCount = 1;// 页面个数

	private int visitCount = 0;// 总记录数

	private int pageSize = 10;// 页面大小

	private int pageNum=1;// 当前页面位置数

	private List<Object> pageList;

	public Page() {
		
	}

	public Page(int pageSize, int pageNum) {
		this.pageSize = pageSize;
		this.pageNum = pageNum;
	}

	public Page(int pageNum) {
		this.pageNum = pageNum;
	}

	public int getStartNum() {
		return startNum;
	}

	public void setStartNum(int startNum) {
		this.startNum = startNum;
	}

	public int getPageCount() {
		return pageCount;
	}

	public void setPageCount(int pageCount) {
		this.pageCount = pageCount;
	}

	public int getVisitCount() {
		return visitCount;
	}
    
	/**@Desc 最后使用该函数，初始化参数
	 * @param visitCount
	 */
	public void setVisitCount(int visitCount) {
		//设置页数
		this.visitCount = visitCount;
		//设置开始的行数
		this.startNum = (pageNum - 1) * pageSize + 1;
		// 计算页面个数
		if (visitCount % pageSize == 0) {
			this.pageCount = visitCount / pageSize;
		} else {
			this.pageCount = visitCount / pageSize + 1;
		}
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getPageNum() {
		return pageNum;
	}

	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}

	public List<Object> getPageList() {
		return pageList;
	}

	public void setPageList(List pageList) {
		this.pageList = pageList;
	}
	public static void main(String[] args) {
        Page page=new Page();
        page.setPageNum(4);
        page.setVisitCount(50);
	}
}
